var util = require('../../utils/request.js');
var globalData = getApp().globalData;
Page({

  /**
   * 页面的初始数据
   */
  data: {
    userInfo: {},
    starNumber: '',
    vipNumber: ''
  },
  // 跳转我的车牌界面
  myCard() {
    wx.navigateTo({
      url: '../plateNumList/plateNumList',
    })
  },
  // 跳转余额明细
  balanceDetail() {
    wx.navigateTo({
      url: '../fineBalance/fineBalance'
    })
  },
  //跳转停车记录页面
  parkRecord: function () {
    wx.navigateTo({
      url: '../order/order'
    })
  },
  //跳转PLUS会员
  PLUS_VIP: function () {
    wx.navigateTo({
      url: '../plus_vip/plusvip'
    })
  },
  //跳转基础会员
  BasicVip: function () {
    wx.navigateTo({
      url: '../basic_vip/basicvip'
    })
  },
  //跳转我的卡卷页面
  coupon: function () {
    wx.navigateTo({
      url: '../coupon/coupon'
    })
  },
  //跳转钱包充值页面
  walletRecharge: function () {
    wx.navigateTo({
      url: '../wallet/wallet'
    })
  },
  //跳转设置页面
  setup: function () {
    wx.navigateTo({
      url: '../setup/setup'
    })
  },
  //跳转客服页面
  customerService: function () {
    wx.navigateTo({
      url: '../customerService/customerService'
    })
  },
  //跳转我的收藏页面
  myCollection: function () {
    wx.navigateTo({
      url: '../myCollection/myCollection'
    })
  },
  //跳转个人信息页
  personInfo: function () {
    wx.navigateTo({
      url: '../personal/personal'
    })
  },
  // 查看会员等级
  changeMessage() {
    var that = this;
    that.setData({
      userInfo: globalData.userInfo
    })
    var starNumber = [];
    for (let i = 0; i < globalData.userInfo.star; i++) {
      that.setData({
        starNumber: starNumber.push('1')
      })
    }
    if (globalData.userInfo.star == 1) {
      that.setData({
        vipNumber: '一星会员'
      })
    } else if (globalData.userInfo.star == 2) {
      that.setData({
        vipNumber: '二星会员'
      })
    } else if (globalData.userInfo.star == 3) {
      that.setData({
        vipNumber: '三星会员'
      })
    } else if (globalData.userInfo.star == 4) {
      that.setData({
        vipNumber: '四星会员'
      })
    } else if (globalData.userInfo.star == 5) {
      that.setData({
        vipNumber: '五星会员'
      })
    }
  },
  /**
   * 生命周期函数--监听页面加载
   */
  onLoad: function (options) {
    var that = this;
  },

  /**
   * 生命周期函数--监听页面初次渲染完成
   */
  onReady: function () {

  },

  /**
   * 生命周期函数--监听页面显示
   */
  onShow: function () {
    var that = this;
    that.changeMessage();
  },

  /**
   * 生命周期函数--监听页面隐藏
   */
  onHide: function () {

  },

  /**
   * 生命周期函数--监听页面卸载
   */
  onUnload: function () {

  },

  /**
   * 页面相关事件处理函数--监听用户下拉动作
   */
  onPullDownRefresh: function () {

  },

  /**
   * 页面上拉触底事件的处理函数
   */
  onReachBottom: function () {

  },

  /**
   * 用户点击右上角分享
   */
  onShareAppMessage: function () {

  },
  _jump(evt){
    util.jump(evt);
  }
})